angular.module('mamApp').factory('ImageManager', ['$http', 'api', function ($http, api) {
    var ImageManager = {

        /**
         *  上传图片
         * @returns result
         */
        imageUpload: function (params) {
            return $http.post(api + '/admin/image', params).then(function (result) {
                return result;
            });
        },
        coverImageList: function (url) {
            
            var tmpArray = url.split(".");

            var imageType = tmpArray.pop();
            var fileCover300 = tmpArray.join(".") + '_300_300.' + imageType
            var fileCover200 = tmpArray.join(".") + '_200_200.' + imageType
            var fileCover180 = tmpArray.join(".") + '_180_180.' + imageType
            var fileCover120 = tmpArray.join(".") + '_120_120.' + imageType
            var fileCover80 = tmpArray.join(".") + '_80_80.' + imageType

            return [{url:fileCover300,imageWidth:300,imageHeight:300},{url:fileCover200,imageWidth:200,imageHeight:200},{url:fileCover180,imageWidth:180,imageHeight:180},{url:fileCover120,imageWidth:120,imageHeight:120},{url:fileCover80,imageWidth:80,imageHeight:80}]


        }


    };

    return ImageManager;
}]);
